home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DESDOS.ARJ / BENCHMAR.C next >
C/C++ Source or Header  |  1989-01-30  |  655b  |  43 lines

  1. /* Just run DES in a loop consuming CPU time; good for benchmarking
  2.  * Phil Karn
  3.  */
  4. #include <stdio.h>
  5. main()
  6. {
  7.     char key[8],work[8];
  8.     long iter,count;
  9.  
  10.     desinit(0);
  11.     printf("Enter key: ");
  12.     get8(key);
  13.     printf("Setting key: "); put8(key); printf("\n");
  14.     setkey(key);
  15.     printf("Enter starting value: ");
  16.     get8(work);
  17.     printf("Starting value: "); put8(work); printf("\n");
  18.     printf("Number of iterations: ");
  19.     scanf("%ld",&count);
  20.  
  21.     for(iter = 0;iter < count; iter++)
  22.         endes(work);
  23. }
  24. get8(cp)
  25. char *cp;
  26. {
  27.     int i,t;
  28.  
  29.     for(i=0;i<8;i++){
  30.         scanf("%2x",&t);
  31.         *cp++ = t;
  32.     }
  33. }
  34. put8(cp)
  35. char *cp;
  36. {
  37.     int i;
  38.  
  39.     for(i=0;i<8;i++){
  40.         printf("%2x ",*cp++ & 0xff);
  41.     }
  42. }
  43.